From e5417ae6f97aeb2b6c35b2e8de2b7b9f237ded62 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 21 Jun 2007 21:36:26 +0100 Subject: [PATCH] i386: Simplify failsafe callback handling. Signed-off-by: Keir Fraser --- xen/arch/x86/x86_32/entry.S | 14 +++----------- xen/include/asm-x86/x86_32/asm_defns.h | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/x86_32/entry.S b/xen/arch/x86/x86_32/entry.S index 06eda7bff1..8ca596e15f 100644 --- a/xen/arch/x86/x86_32/entry.S +++ b/xen/arch/x86/x86_32/entry.S @@ -99,17 +99,9 @@ restore_all_guest: .Lrestore_iret_guest: .Lft5: iret .section .fixup,"ax" -.Lfx1: subl $28,%esp - pushl 28(%esp) # error_code/entry_vector - movl %eax,UREGS_eax+4(%esp) - movl %ebp,UREGS_ebp+4(%esp) - movl %edi,UREGS_edi+4(%esp) - movl %esi,UREGS_esi+4(%esp) - movl %edx,UREGS_edx+4(%esp) - movl %ecx,UREGS_ecx+4(%esp) - movl %ebx,UREGS_ebx+4(%esp) - sti - popl %esi +.Lfx1: sti + SAVE_ALL_GPRS + mov UREGS_error_code(%esp),%esi pushfl # EFLAGS movl $__HYPERVISOR_CS,%eax pushl %eax # CS diff --git a/xen/include/asm-x86/x86_32/asm_defns.h b/xen/include/asm-x86/x86_32/asm_defns.h index c12039e910..6bf7e2c619 100644 --- a/xen/include/asm-x86/x86_32/asm_defns.h +++ b/xen/include/asm-x86/x86_32/asm_defns.h @@ -26,6 +26,17 @@ #define ASSERT_INTERRUPTS_ENABLED ASSERT_INTERRUPT_STATUS(nz) #define ASSERT_INTERRUPTS_DISABLED ASSERT_INTERRUPT_STATUS(z) +#define SAVE_ALL_GPRS \ + cld; \ + pushl %eax; \ + pushl %ebp; \ + SETUP_EXCEPTION_FRAME_POINTER; \ + pushl %edi; \ + pushl %esi; \ + pushl %edx; \ + pushl %ecx; \ + pushl %ebx + /* * Saves all register state into an exception/interrupt stack frame. * Returns to the caller at if the interrupted context is within @@ -36,15 +47,7 @@ * the caller is reponsible for validity of %ds/%es. */ #define SAVE_ALL(xen_lbl, vm86_lbl) \ - cld; \ - pushl %eax; \ - pushl %ebp; \ - SETUP_EXCEPTION_FRAME_POINTER; \ - pushl %edi; \ - pushl %esi; \ - pushl %edx; \ - pushl %ecx; \ - pushl %ebx; \ + SAVE_ALL_GPRS; \ testl $(X86_EFLAGS_VM),UREGS_eflags(%esp); \ mov %ds,%edi; \ mov %es,%esi; \ -- 2.30.2